import request from '@/utils/request';

/**
 * 新增用户
 * @param {*} user
 */
export const save = user => {
  return request({
    url: '/admin/user/register',
    data: user,
    method: 'post'
  });
};

/**
 * 更新用户信息
 * @param {} user
 */
export const update = user => {
  return request({
    url: '/admin/user/update',
    data: user,
    method: 'post'
  });
};

/**
 * 获取用户详情
 * @param {*} id
 */
export const get = id => {
  return request({
    url: '/admin/user/get',
    data: {
      id: id
    },
    method: 'post'
  });
};

/**
 * 删除用户信息
 * @param {*} id
 */
export const remove = id => {
  return request({
    url: '/admin/user/delete',
    data: {
      id: id
    },
    method: 'post'
  });
};

/**
 * 分页查询用户信息
 * @param {*} pageParam
 */
export const page = pageParam => {
  return request({
    url: '/admin/user/page',
    data: pageParam,
    method: 'post'
  });
};

/**
 * 修改密码
 * @param {*} params
 */
export const changeAuth = params => {
  return request({
    url: '/admin/user/changeAuth',
    data: params,
    method: 'post'
  });
};

/**
 * 删除用户信息
 * @param {*} id
 */
export const resetPwd = id => {
  return request({
    url: '/admin/user/resetPwd',
    data: {
      id: id
    },
    method: 'post'
  });
};
/**
 * 修改密码
 * @param {*} id
 */
export const forceResetPwd = newAuth => {
  return request({
    url: '/admin/user/forceResetPwd',
    data: {
      agentAuth: 'agentAuth',
      newAuth: newAuth
    },
    method: 'post'
  });
};
